<?php
    echo $this->partial('progress_bar.phtml', $this);
?>

<?php if( $this->form->isErrors() ):?>
<div class="errors_parnel">
	Some errors are found
</div>
<?php endif;?>
<script type="text/javascript" src="<?php echo STATIC_URL .  "/media/vendor/tiny_mce/jquery.tinymce.js"?>"></script>
<?php echo $this->form;?>
<script>
	jQuery("document").ready(function($){
	<?php if( !empty($this->contest->title) ):?>
		addTab("<?php echo Core_Util::escapeForJs2($this->contest->getTitle()) ?>", '<?php echo $this->url() ?>');
	<?php endif;?>
		$('#<?php echo $this->form->getId() ?>').ymFormHandle({
			usingSimplePrize : <?php echo (defined('USING_SIMPLE_PRIZE') && USING_SIMPLE_PRIZE == 1)?'true':'false'?>
		});		
		$("#<?php echo $this->form->getId()?>").ymHandleFanpages({
			selector			: '#fanpages-label+dd',
			pageName			: '<?php echo Contest_Form_Abstract::FANPAGE_NAME ?>',
			confirmTitle		: '<?php echo $this->translate('Confirm this action') ?>',
			confirmTemplate		: '<?php echo YouNet_Util::htmlToJs($this->social->render('dialogAskPageInstall',array('app_name'=>'Pair'))) ?>',
			translate			: {
				LOAD_MY_FAN_PAGES	: '<?php echo $this->translate('LOAD_MY_FANPAGES') ?>',
				CREATE_A_PAGE		: '<?php echo $this->translate('CREATE_A_PAGE') ?>'
			}
		});
		<?php /** fix bug IE 9 FBCONTACT-415 **/?>
		$("#<?php echo $this->form->getId() ?>").submit(function(e){
            if( this.term_and_condition )
            {
                this.term_and_condition.value = $('#term_and_condition').val();
            }
		});
        canvasScrollTo(0,0);
        
        //show popup preview 
        $('#preview_social_like').click(function (e) {
            
            var screenWidth = document.body.clientWidth || document.documentElement.clientWidth || self.innerWidth;
            var screenHeight = document.body.clientHeight || document.documentElement.clientHeight || self.innerHeight;
            
            var left = (screenWidth - $("#model-content-like").width())/2;
            var top =  (screenHeight - $("#model-content-like").height())/2;
            
            var position = $("#model-content-like").offset();
            
            $('#model-content-like').modal(
                {position: [top,left]}
            );
            return false;
        });
        $('#preview_two_col_entry').click(function (e) {
            
            var screenWidth =document.body.clientWidth || document.documentElement.clientWidth || self.innerWidth;
            var screenHeight = document.body.clientHeight || document.documentElement.clientHeight || self.innerHeight;
            
            var left = (screenWidth - $("#model-content-two-col" ).width())/2;
            var top = (screenHeight - $("#model-content-two-col").height())/2;
            
            var position = $("#model-content-like").offset();
            $('#model-content-two-col').modal(
                {position: [top,left]}
            );
            return false;
        });
	});
    
    
</script>

<div id="model-content-like">
    <img src="<?php  echo STATIC_URL ."/img/social_like_btns_preview.jpg"?>">
</div>
<div id="model-content-two-col">
    <img src="<?php  echo STATIC_URL ."/img/entry_two_columns_preview.jpg"?>">
</div>